package string;

public class MatchesDemo {
    public static void main(String[] args) {
        /*[a-zA-Z0-9]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+*/
        String email = "wtx@qq.com";
        String regex = "[a-zA-Z0-9]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
        boolean match = email.matches(regex);
        if (match){
            System.out.println("邮箱正确");
        }else {
            System.out.println("邮箱不正确");
        }
    }
}
